import { Groove, Hole, Profile } from '@/types';
import {
  BasePlank,
  PlankMark,
  BaseHole,
  BaseGroove,
  BaseTextureDirection,
  HightLight,
} from './modules';
export {
  PlankEdgeLegend,
  PlankPropsValidate,
  PlankBaseInfo,
  HoleAndGrooveInfo,
  PlankSelect,
} from './modules';

interface Props {
  profile: Profile;
  inners?: Profile[];
  width: number;
  height: number;
  holes: Hole[];
  grooves: Groove[];
  thickness: number;
  hightLight: HightLight;
  edgeBanding: number[];
  textureDirection: string;
}

export function Plank(props: Props) {
  const {
    profile,
    inners,
    width,
    height,
    thickness,
    holes,
    grooves,
    hightLight,
    edgeBanding,
    textureDirection,
  } = props;

  return (
    <>
      <BasePlank
        {...{ profile, inners, width, height, thickness, edgeBanding }}
      />
      <PlankMark {...{ width, height, profile, holes, grooves }} />
      {holes.map((hole) => {
        return <BaseHole key={hole.holeId} {...{ hole, hightLight }} />;
      })}
      {grooves.map((groove) => {
        return (
          <BaseGroove
            key={groove.grooveId}
            {...{ thickness, groove, hightLight, width, height }}
          />
        );
      })}
      <BaseTextureDirection {...{ thickness, textureDirection }} />
    </>
  );
}
